The present invention relates to an image encoding method and apparatus, and more particularly, to an image encoding method and apparatus for accurately controlling the number of bits generated with respect to image data encoded using quantization activities.
There have been recently proposed various methods for encoding video and audio signals into digital data to be transmitted or stored in a storage medium, and decoding the encoded digital data in order to reproduce the video and audio signals. International standardization is required for industrial use of an encoding and decoding system. As a result, standardization such as MPEG (Moving Picture Expert Group)-1 and MPEG-2 of ISO/IEC as well as H.261 of ITU-TS has been made. According to such standardization, a picture is divided into blocks each having an M(horizontal).times.N(vertical) size and is encoded via discrete cosine transform (DCT), quantization, variable-length-coding, motion estimation and motion compensation encoding, and differential pulse coded modulation (DPCM) methods.
An apparatus for encoding data into the number of variable bits uses a buffer memory for outputting the encoded data at a constant bit rate. By the way, since the amount of the encoded data varies according to contents of images, it is difficult to accurately estimate the quantity of encoded data with respect to each frame. On the other hand, a buffer memory has a limited data capacity and a transmission channel has a limited bandwidth. As a result, problems have arisen that data is lost by an overflow of a buffer memory and an available transmission band is not sufficiently used by an underflow of the buffer memory. Thus, it is essential that the amount of encoded data is properly controlled in order to avoid data loss and sufficiently utilize an available transmission band.
Thus far, the amount of bits generated is controlled by adjusting a quantization stepsize according to a fullness of a buffer memory. That is, when the amount of data stored in a buffer memory is large, a quantization stepsize is made large in order to prevent an overflow of a buffer memory, thereby reducing the number of bits generated of the encoded data. When the amount of data stored in a buffer memory is small, a quantization stepsize is made small in order to prevent an underflow of a buffer memory, thereby increasing the number of bits generated of the encoded data.
In case when a change of a quantization stepsize relies slightly on a fullness of a buffer memory, an underflow and an overflow may frequently occur in the buffer memory due to indefinite change of the number of the generated bits according to the quantization stepsize. Once an overflow or an underflow occurs in a buffer memory, it takes long to remove such an occurrence. The data loss due to an overflow in a buffer memory may make it impossible to decode the lost data in a decoder. The underflow in a buffer memory makes a band utilization efficiency worse to thereby increase costs. On the contrary, in case when a quantization stepsize relies excessively on a fullness of a buffer memory, an overflow and an overflow may be prevented. However, since a quantization stepsize responds very sensitively to the fullness of a buffer memory, restoring the encoded data causes a picture quality to fluctuate.
Since the amount of the encoded data varies according to contents of an image, the amount of bits generated cannot be accurately controlled using a method of varying a quantization stepsize based on a fullness of a buffer memory. In other words, relationship between a quantization stepsize and a fullness of a buffer memory varies according to contents of an image, which cannot be established uniformly.